<?php
use yii\db\Schema;
use yii\db\Migration;

class m160422_061324_admin extends Migration
{
    public function up()
    {
    	$this->createTable('admin', [
    			'id' => Schema::TYPE_PK,
    			'adm_username' => Schema::TYPE_STRING . "(255) NOT NULL comment '用户名'",
    			'adm_password' => Schema::TYPE_STRING . "(255) NOT NULL comment '密码'",
    	        'role_id' => Schema::TYPE_INTEGER ."(11) comment '角色id'",
    	]);
    	
    	$this->insert('admin', [
    	    'adm_username' => 'admin',
    	    'adm_password' => 'admin',
    	    'role_id' => '1'
    	]);
    }

    public function down()
    {
        echo "m160422_061324_admin cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
